package com.itlong.cloud.enumerate;

/**
 * <desc>
 *      收费类型枚举
 * </desc>
 *
 * @createDate2021/2/21
 **/
public enum FeeTypeEnum {

    ELEVATOR(1,"电梯类", "元/年/梯", "梯"),
    ENTRANCE(2,"门禁类","元/年/门", "门"),
    FACE(3,"对讲类", "元/年/台", "台"),
    INTERCOM(4,"人脸类","元/年/台", "台");

    private Integer type;
    private String name;
    private String unit;
    private String equipUnit;

    FeeTypeEnum(Integer type, String name, String unit,  String equipUnit){
        this.type = type;
        this.name = name;
        this.unit = unit;
        this.equipUnit = equipUnit;
    }

    /**
     * <desc>
     *      通过产品类型id获取产品类型名称
     * </desc>
     *
     * @param type
     * @return
     * @Author Zhu.yj
     * @createDate  2021/2/21
     */
    public static String getNameByType(Integer type){
        if (type == null){
            return "";
        }
        for (FeeTypeEnum feeTypeEnum : values()){
            if (feeTypeEnum.type == type){
                return feeTypeEnum.name;
            }
        }
        return "";
    }

    /**
     * <desc>
     *      通过产品类型id获取产品收费单位
     * </desc>
     *
     * @param type
     * @return
     * @Author Zhu.yj
     * @createDate  2021/2/21
     */
    public static  String getUnitByType(Integer type){
        if (type == null){
            return "";
        }
        for (FeeTypeEnum feeTypeEnum : values()){
            if (feeTypeEnum.type == type){
                return feeTypeEnum.unit;
            }
        }
        return "";
    }

    /**
     * <desc>
     *      通过产品类型id获取产品收费单位
     * </desc>
     *
     * @param type
     * @return
     * @Author Zhu.yj
     * @createDate  2021/2/21
     */
    public static  String getEquipUnitByType(Integer type){
        if (type == null){
            return "";
        }
        for (FeeTypeEnum feeTypeEnum : values()){
            if (feeTypeEnum.type == type){
                return feeTypeEnum.equipUnit;
            }
        }
        return "";
    }

}
